package org.neptune.service.rabbit;

import org.neptune.api.entity.SeckillLog;
import org.neptune.common.constant.NeptuneConstant;
import org.neptune.service.dao.SeckillLogMapper;
import org.neptune.service.service.EsLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author lwl
 * @date 2019/7/17 17:33
 */
@Component
@RabbitListener(queues = NeptuneConstant.LOG_QUEUE_NAME)
public class LogConsumer {

	private static final Logger logger = LoggerFactory.getLogger(LogConsumer.class);

	@Autowired
	private SeckillLogMapper seckillLogMapper;

	private EsLogService esLogService;

	@RabbitHandler
	public void seckillLogProcess(SeckillLog seckillLog) {

		logger.info("consumer : seckilllog goodsId :{},userId : {}", seckillLog.getSeckillId(),
				seckillLog.getUserId());

		seckillLogMapper.insertSelective(seckillLog);
		// esLogService.
	}
}
